﻿@using TDF.Core.Configuration
@model List<Faurecia.WM.Service.Dtos.WorkTimeDto>
<div class="page-bar">
    <ul class="page-breadcrumb">
        <li>
            <span id="module">@Configs.Instance.GetValue("SystemName")</span>
            <i class="fa fa-angle-right"></i>
        </li>
        <li>
            <span id="action"></span>
        </li>
    </ul>
</div>
<div class="col-md-12">
    <div class="portlet light ">
        <div class="portlet-title tabbable-line">
            <div class="caption">
                <i class="icon-bubbles font-dark hide"></i>
                <span class="caption-subject font-dark bold uppercase"></span>
            </div>
            <ul class="nav nav-tabs" id="nav-tabs">
                @for (var i = 0; i < Model.Count; i++)
                {
                    <li class="@(i==0?"active":"")">
                        <a href="@("#portlet_"+i)" data-id="@Model[i].Id" data-toggle="tab" aria-expanded="@((i==0).ToString().ToLower())"> @Model[i].Name </a>
                    </li>
                }
            </ul>
        </div>
        <div class="portlet-body">
            <div class="tab-content" id="tab-content">
                @for (var i = 0; i < Model.Count; i++)
                {
                    <div class="tab-pane@(i == 0 ? " active" : "")" id="@("#portlet_"+i)">

                    </div>
                }
            </div>
        </div>
    </div>
</div>
<!-- END PAGE BAR -->
@section scripts{
    <script type="text/javascript">
        var workTimeId = '';
        $(function () {
            workTimeId = $("#nav-tabs li.active a").attr("data-id");
            loadTab();
            $("#nav-tabs li a").click(function () {
                workTimeId = $(this).attr("data-id");
                loadTab();
            });

        });

        function loadTab() {
            var $container = $("#tab-content .tab-pane.active");
            $container.load("@Url.Action("RuleConfigruation")?WorkTimeId=" + workTimeId);
        }
    </script>
}